package com.test.springcloudservice.util;

import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Log4j2
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public ResponseData exceptionHandler(Exception e) {
        log.error(e.getMessage());
        return ResponseData.fail("服务器异常：" + e.getMessage());
    }
}
